import React, { Component } from 'react';

class Form extends Component {

  constructor() {
    super();
    this.state = {
      txt: ''
    }
  }

  handleChange = (event) => {
    this.setState({
      txt: event.target.value
    })
  }



  render() {
    return (
      <div>
        <input type="text" value={this.state.txt} onChange={this.handleChange} /> <button onClick={()=>this.props.handleAdd(this.state.txt)}>添加</button>
      </div>
    );
  }
}

export default Form;